home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
music
/
eked-m1.zoo
/
src
/
gm
/
gem_man.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-19
|
8KB
|
269 lines
/*
* EKED-M1 : Editor for Korg M1 synth; gem_man.h : GEM defines/types/externs
* Copyright (C) 1995 Steven M. Eker (Steven.Eker@brunel.ac.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define ED_START 0
#define ED_INIT 1
#define ED_CHAR 2
#define ED_END 3
#define DESK 0
#define MAX_WINDOWS 16
#define MAX_EQUIV 64
#define OUT_OF_WINDOWS (-1)
#define OUT_OF_MEMORY (-2)
typedef enum {
E_CLICK, /* mouse click in window */
E_MESSAGE, /* AES message to window */
E_DRAG, /* object dragged onto window */
E_DROP, /* object dropped onto window */
E_DRAGEXIT, /* object dragged out of window */
E_USER, /* non-AES message sent to window by wm_send_user() */
E_CLEANUP, /* window about to be closed, only handle, type and */
/* usr_val are valid */
E_KEYPRESS /* key pressed while mouse over window */
} E_TYPE;
typedef struct {
int n_clks; /* number of clicks */
int m_state; /* mouse state */
int m_x; /* mouse x position (or cell x-coord for list window) */
int m_y; /* mouse y position (or cell y-coord for list window) */
} CLICK;
typedef struct {
int k_state; /* state of shift/ctrl/alt keys */
int k_ret; /* physical (hi-byte) & ASCII (lo-byte) codes */
} KEYPRESS;
typedef struct {
int m_x; /* mouse x position */
int m_y; /* mouse y position */
long object; /* (probably pointer to) object */
} DRAG_DROP;
typedef struct {
int code; /* key and shift status code */
int title; /* number of menu title object */
int item; /* number of menu item object */
} KEY_EQUIV;
/*
* Return values from action function
*/
#define R_NORMAL 0
#define R_QUIT 1
#define R_NOACT 2
/*
* Value rolling modes
*/
#define R_ROLL 0
#define R_RIGHTUP 1
#define R_LEFTUP 2
/*
* Macros
*/
#define GM_DEBUG(t,v) \
{ \
char alert[256]; \
sprintf(alert, "[1][%s = %d][ CONT ]", t, v); \
form_alert(1, alert); \
}
#define GM_BOUND_FIX(v, min, max) \
if((v) > (max)) \
(v) = (max); \
else if((v) < (min)) \
(v) = (min)
#define GM_AES2VDI(point, rect) \
( \
(point)[0] = (rect)->g_x, \
(point)[1] = (rect)->g_y, \
(point)[2] = (rect)->g_x + (rect)->g_w - 1, \
(point)[3] = (rect)->g_y + (rect)->g_h - 1 \
)
#define GM_SELECT(flag, tree, ob) \
( \
(tree)[ob].ob_state = (flag) ? ((tree)[ob].ob_state | SELECTED) : \
((tree)[ob].ob_state & ~SELECTED) \
)
#define RDIV(a, b) ((2 * (a) + (b)) / (2 * (b)))
#define MALLOC(t) ((t *) malloc(sizeof(t)))
#define FREE(p) (free((void *) (p)))
/*
* AES new flags
*/
#ifndef FL3DIND
#define FL3DIND 0x0200
#endif
#ifndef FL3DACT
#define FL3DACT 0x0400
#endif
/*
* Standard stuff
*/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef MAX
#define MAX(x, y) (((x) >= (y)) ? (x) : (y))
#endif
#ifndef MIN
#define MIN(x, y) (((x) <= (y)) ? (x) : (y))
#endif
/*
* Call-back function types
*/
typedef void (*DISP_FUNC_PTR)(int x_pos, int y_pos, GRECT *area, long usr_val);
typedef int (*ACT_FUNC_PTR)(int handle, E_TYPE type, void *event,
int x_pos, int y_pos, long usr_val);
typedef int (*MENU_FUNC_PTR)(int title, int item);
typedef void (*UPDATE_FUNC_PTR)(OBJECT *object, int value);
typedef void (*REDRAW_FUNC_PTR)(OBJECT *tree, int ob, GRECT *area);
typedef void (*POS_FUNC_PTR)(int x_pos, int y_pos);
typedef int (*OBJECT_FUNC_PTR)(OBJECT *obj);
typedef char *(*CELL_FUNC_PTR)(int x, int y, long usr_val);
/*
* Global variables
*/
extern MFDB screen;
extern int char_w, char_h;
extern GRECT desk;
extern int nr_planes;
extern int gm_handle;
extern USERBLK gm_button;
/*
* External functions defined in gem_man.c and related macro
*/
#define gm_clsvwk(h) v_clsvwk(h)
void gm_init();
void gm_exit();
int gm_opnvwk();
void gm_xorbox(GRECT *box);
int gm_opaque(OBJECT *tree, int ob);
int gm_roll_mode(int mode);
int gm_roll(OBJECT *tree, int ob, int value, int min, int max,
UPDATE_FUNC_PTR update, REDRAW_FUNC_PTR redraw);
int intersect(GRECT *r1, GRECT *r2);
/*
* External functions defined in rsc_man.c
*/
int rm_load(char *filename);
int rm_free(void);
int rm_gaddr(int type, int index, void *addr);
void rm_map_tree(OBJECT *tree, OBJECT_FUNC_PTR func);
void rm_map_all(OBJECT_FUNC_PTR func);
/*
* External functions defined in wind_man.c and related macros
*/
#define wm_init() /* no op */
#define wm_update(handle) wm_send_redraw(handle, (GRECT *) NULL)
void wm_exit();
void wm_getdata(int handle, int *x_pos, int *y_pos, long *usr_val);
void wm_send_redraw(int handle, GRECT *area);
void wm_send_user(int handle, long object);
void wm_redraw(int handle, GRECT *area);
int wm_open(int parts, GRECT *init, char *title,
int con_w, int con_h, int x_scroll, int y_scroll,
DISP_FUNC_PTR display, ACT_FUNC_PTR action, long usr_val);
void wm_closed(int h);
void wm_moved(int handle, GRECT *area);
void wm_sized(int handle, GRECT *area);
void wm_fulled(int handle);
void wm_arrowed(int handle, int dir);
void wm_hslid(int handle, int pos);
void wm_vslid(int handle, int pos);
void wm_topped(int handle);
void wm_flush(int redraw_flag);
void wm_monitor(OBJECT *menu, MENU_FUNC_PTR menu_handler);
void wm_cycle();
int wm_roll(int handle, OBJECT *tree, int ob, int value,
int min, int max, UPDATE_FUNC_PTR update);
void wm_ob_update(int handle, OBJECT *tree, int ob);
void wm_ob_redraw(int handle, OBJECT *tree, int ob, GRECT *area);
int wm_do_button(int handle, OBJECT *tree, int ob, int toggle);
void wm_dragbox(GRECT *position, long object);
/*
* External functions defined in key_man.c
*/
KEY_EQUIV *km_get_equiv(int k_state, int k_ret);
void km_set_equiv(int k_state, int k_ret, int title, int item);
void km_scan_menu(OBJECT *menu);
/*
* External functions defined in form_man.c and related macro
*/
#define fm_roll(tree, ob, value, min, max, update) \
gm_roll(tree, ob, value, min, max, update, &fm_ob_redraw)
int fm_dialog(OBJECT *tree, int ed, OBJECT *org_tree, int org_ob);
void fm_begin_dialog(OBJECT *tree, int ed);
int fm_run_dialog();
void fm_end_dialog();
int fm_form_do(OBJECT *tree, int ed);
char *fm_file_select(char *title, char *mask, char *filename);
void fm_ob_redraw(OBJECT *tree, int ob, GRECT *area);
int fm_alert(int but, int n);
/*
* External functions defined in mag.c and related macro
*/
#define mg_exit() /* no op */
void mg_init();
void magnify();
/*
* External functions defined in list_man.c
*/
int lm_open(GRECT *init, char *title,
int x_cells, int y_cells, int x_sep, int y_sep,
int width, int text_size, int b_color, int t_color,
CELL_FUNC_PTR content, ACT_FUNC_PTR usr_action, long usr_val);
void lm_update(int handle, int x, int y);
void lm_dragbox(int handle, int x, int y, long item);
/*
* Misc macros
*/
#define BEG_BUSY (wm_flush(TRUE), graf_mouse(HOURGLASS, 0L))
#define BEG_DRAG graf_mouse(FLAT_HAND, 0L)
#define BEG_SIZE graf_mouse(POINT_HAND, 0L)
#define END_BUSY graf_mouse(ARROW, 0L)
#define END_DRAG graf_mouse(ARROW, 0L)
#define END_SIZE graf_mouse(ARROW, 0L)